package com.hobart.learning.lagou.edu.IPersistence.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：hobart
 * @date ：Created in 2020-11-11 1:18
 * @description：标记处理
 * @modified By：
 * @version: 1$
 */
public class ParameterMappingTokenHandler implements TokenHandler {

    private List<ParameterMapping> parameterMappings = new ArrayList<>();

    // content 是 参数名称 #{id} #{username}
    @Override
    public String handleToken(String content) {
        parameterMappings.add(builderParameterMapping(content));
        return "?";
    }

    private ParameterMapping builderParameterMapping(String content) {
        ParameterMapping parameterMapping = new ParameterMapping(content);
        return parameterMapping;
    }

    public List<ParameterMapping> getParameterMappings() {
        return parameterMappings;
    }

    public void setParameterMappings(List<ParameterMapping> parameterMappings) {
        this.parameterMappings = parameterMappings;
    }
}
